/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ie.tcd.cs.railtickets.server.domain;

import java.io.Serializable;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Wenbo Sun
 */
@Entity
@Table(name = "station")
public class Station implements Serializable {

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "station_id")
    private long id;

    @Column(name = "station_name", unique = true)
    private String name;

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "station")
    private Set<RouteStation> routeStations;

    public Station() {
    }

    public Station(long id) {
        this.id = id;
    }

    public Station(String name) {
        this.name = name;
    }

    public long getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Set<RouteStation> getRouteStations() {
        return routeStations;
    }

    public void setRouteStations(Set<RouteStation> routeStations) {
        this.routeStations = routeStations;
    }

}
